package com.own.demo.lwf.utils.javaUtils;

import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author liwenfeng
 * @Description 结果响应工具类
 * @Date 2023/07/07/16:10
 * @Version 1.0
 */
public class ResponseUtil {
    public static void out(HttpServletResponse response, ResponseEntity r) {
        ObjectMapper mapper = new ObjectMapper();
        // response.setStatus(HttpStatus.OK.value());
        // response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
        try {
            mapper.writeValue(response.getWriter(), r);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
